package com.sgb.kjwl.model.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import com.sgb.kjwl.model.entity.self.AddField;
import com.sgb.kjwl.utils.NumberUtil;

import java.io.Serializable;
import java.util.List;

/**
 * Describe:
 * Author:  yangLei
 * Date:    2021/4/22
 */
public class OrderEntity implements Serializable , Parcelable {

    private String goodsSourceNo;
    private String carNumber;
    private String carType;
    private String carLen;
    private String heightHurdle;
    private String isDump;
    private String weight;

    private String provinceName;
    private String cityName;
    private String districtName;
    private String detailAddress;

    private String carImage;
    private String driverNo;
    private String provinceNo;//省编号
    private String cityNo;//市编号
    private String districtNo;//区编号
    private String lng;//发货地经度
    private String lat;//发货地维度
    private String allFreight;//总运费
    private String messagePrice;//信息费
    private String goodsOfferNo;//2.0.3报价新增
    private String carOfferNo;//2.0.3报价新增修改状态用
    private String note;
    List<AddField> diyField;
    //新增字段标识是否是报价确认接单
    private Boolean isQuotation = false;//false 默认否
    //新增字段  json
    private String addField;
    private long  inTime;//进场时间
    private String carriageCommitment;//承运承诺
    private int freightUnit;//报价单位 1：元/趟，2：元/吨，3：元/方
    private String invoiceInfoId;//开票单位编号
    private String marketingPublicity;//营销宣传


    public String getDriverNo() {
        return driverNo;
    }

    public void setDriverNo(String driverNo) {
        this.driverNo = driverNo;
    }

    public String getCarType() {
        return carType;
    }

    public void setCarType(String carType) {
        this.carType = carType;
    }

    public String getCarLen() {
        return carLen;
    }

    public void setCarLen(String carLen) {
        this.carLen = carLen;
    }

    public String getHeightHurdle() {
        return heightHurdle;
    }

    public void setHeightHurdle(String heightHurdle) {
        this.heightHurdle = heightHurdle;
    }


    public String getIsDump() {
        if (TextUtils.isEmpty(isDump)){
            return "";
        }
        if ("1".equals(isDump)){
            return "自卸";
        }else if ("0".equals(isDump)){
            return "非自卸";
        }
        return isDump;
    }

    public void setIsDump(String isDump) {
        this.isDump = isDump;
    }

    public String getWeight() {
        if (TextUtils.isEmpty(weight)){
            return "";
        }
        return NumberUtil.trim0(weight)+"吨";
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getDistrictName() {
        return districtName;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    public String getCarImage() {
        return carImage;
    }

    public void setCarImage(String carImage) {
        this.carImage = carImage;
    }

    public String getGoodsSourceNo() {
        return goodsSourceNo;
    }

    public void setGoodsSourceNo(String goodsSourceNo) {
        this.goodsSourceNo = goodsSourceNo;
    }

    public String getCarNumber() {
        return carNumber;
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getProvinceNo() {
        return provinceNo;
    }

    public void setProvinceNo(String provinceNo) {
        this.provinceNo = provinceNo;
    }

    public String getCityNo() {
        return cityNo;
    }

    public void setCityNo(String cityNo) {
        this.cityNo = cityNo;
    }

    public String getDistrictNo() {
        return districtNo;
    }

    public void setDistrictNo(String districtNo) {
        this.districtNo = districtNo;
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getAllFreight() {
        return allFreight;
    }

    public void setAllFreight(String allFreight) {
        this.allFreight = allFreight;
    }

    public String getMessagePrice() {
        return messagePrice;
    }

    public void setMessagePrice(String messagePrice) {
        this.messagePrice = messagePrice;
    }

    public String getGoodsOfferNo() {
        return goodsOfferNo;
    }

    public void setGoodsOfferNo(String goodsOfferNo) {
        this.goodsOfferNo = goodsOfferNo;
    }

    public String getCarOfferNo() {
        return carOfferNo;
    }

    public void setCarOfferNo(String carOfferNo) {
        this.carOfferNo = carOfferNo;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public List<AddField> getDiyField() {
        return diyField;
    }

    public void setDiyField(List<AddField> diyField) {
        this.diyField = diyField;
    }

    public String getAddField() {
        return addField;
    }

    public void setAddField(String addField) {
        this.addField = addField;
    }

    public boolean isQuotation() {
        return isQuotation;
    }

    public void setQuotation(boolean quotation) {
        isQuotation = quotation;
    }

    public Boolean getQuotation() {
        return isQuotation;
    }

    public void setQuotation(Boolean quotation) {
        isQuotation = quotation;
    }

    public long getInTime() {
        return inTime;
    }

    public void setInTime(long inTime) {
        this.inTime = inTime;
    }

    public String getCarriageCommitment() {
        return carriageCommitment;
    }

    public void setCarriageCommitment(String carriageCommitment) {
        this.carriageCommitment = carriageCommitment;
    }

    public int getFreightUnit() {
        return freightUnit;
    }

    public void setFreightUnit(int freightUnit) {
        this.freightUnit = freightUnit;
    }

    public String getInvoiceInfoId() {
        return invoiceInfoId;
    }

    public void setInvoiceInfoId(String invoiceInfoId) {
        this.invoiceInfoId = invoiceInfoId;
    }

    public String getMarketingPublicity() {
        return marketingPublicity;
    }

    public void setMarketingPublicity(String marketingPublicity) {
        this.marketingPublicity = marketingPublicity;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.goodsSourceNo);
        dest.writeString(this.carNumber);
        dest.writeString(this.carType);
        dest.writeString(this.carLen);
        dest.writeString(this.heightHurdle);
        dest.writeString(this.isDump);
        dest.writeString(this.weight);
        dest.writeString(this.provinceName);
        dest.writeString(this.cityName);
        dest.writeString(this.districtName);
        dest.writeString(this.detailAddress);
        dest.writeString(this.carImage);
        dest.writeString(this.driverNo);
        dest.writeString(this.provinceNo);
        dest.writeString(this.cityNo);
        dest.writeString(this.districtNo);
        dest.writeString(this.lng);
        dest.writeString(this.lat);
        dest.writeString(this.allFreight);
        dest.writeString(this.messagePrice);
        dest.writeString(this.goodsOfferNo);
        dest.writeString(this.carOfferNo);
        dest.writeString(this.note);
        dest.writeTypedList(this.diyField);
        dest.writeByte((byte) (isQuotation == null ? 0 : isQuotation ? 1 : 2));
        dest.writeString(this.addField);
        dest.writeLong(this.inTime);
        dest.writeString(this.carriageCommitment);
        dest.writeInt(this.freightUnit);
        dest.writeString(this.invoiceInfoId);
        dest.writeString(this.marketingPublicity);
    }

    public void readFromParcel(Parcel source) {
        this.goodsSourceNo = source.readString();
        this.carNumber = source.readString();
        this.carType = source.readString();
        this.carLen = source.readString();
        this.heightHurdle = source.readString();
        this.isDump = source.readString();
        this.weight = source.readString();
        this.provinceName = source.readString();
        this.cityName = source.readString();
        this.districtName = source.readString();
        this.detailAddress = source.readString();
        this.carImage = source.readString();
        this.driverNo = source.readString();
        this.provinceNo = source.readString();
        this.cityNo = source.readString();
        this.districtNo = source.readString();
        this.lng = source.readString();
        this.lat = source.readString();
        this.allFreight = source.readString();
        this.messagePrice = source.readString();
        this.goodsOfferNo = source.readString();
        this.carOfferNo = source.readString();
        this.note = source.readString();
        this.diyField = source.createTypedArrayList(AddField.CREATOR);
        byte tmpIncludeTax = source.readByte();
        isQuotation = tmpIncludeTax == 0 ? null : tmpIncludeTax == 1;
        this.addField = source.readString();
        this.inTime = source.readLong();
    }

    public OrderEntity() {
    }

    protected OrderEntity(Parcel in) {
        this.goodsSourceNo = in.readString();
        this.carNumber = in.readString();
        this.carType = in.readString();
        this.carLen = in.readString();
        this.heightHurdle = in.readString();
        this.isDump = in.readString();
        this.weight = in.readString();
        this.provinceName = in.readString();
        this.cityName = in.readString();
        this.districtName = in.readString();
        this.detailAddress = in.readString();
        this.carImage = in.readString();
        this.driverNo = in.readString();
        this.provinceNo = in.readString();
        this.cityNo = in.readString();
        this.districtNo = in.readString();
        this.lng = in.readString();
        this.lat = in.readString();
        this.allFreight = in.readString();
        this.messagePrice = in.readString();
        this.goodsOfferNo = in.readString();
        this.carOfferNo = in.readString();
        this.note = in.readString();
        this.diyField = in.createTypedArrayList(AddField.CREATOR);
        byte tmpIncludeTax = in.readByte();
        isQuotation = tmpIncludeTax == 0 ? null : tmpIncludeTax == 1;
        this.addField = in.readString();
        this.inTime = in.readInt();
        this.carriageCommitment = in.readString();
        this.freightUnit = in.readInt();
        this.invoiceInfoId = in.readString();
        this.marketingPublicity = in.readString();
    }

    public static final Creator<OrderEntity> CREATOR = new Creator<OrderEntity>() {
        @Override
        public OrderEntity createFromParcel(Parcel source) {
            return new OrderEntity(source);
        }

        @Override
        public OrderEntity[] newArray(int size) {
            return new OrderEntity[size];
        }
    };
}
